package com.grep.extra.factory.data.impl;

import java.util.Collection;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

import com.grep.extra.factory.data.IContent;
import com.grep.extra.factory.data.IDataQueue;

public class ContentDataQueue<IContent> implements IDataQueue<IContent>  {
	
	private BlockingQueue<IContent> data = new  LinkedBlockingQueue<IContent>();
	
	public void put(IContent t) {
		try {
			data.put(t) ;
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

	public IContent take() {
		IContent ic  = null ;
		try {
			ic = data.take() ;
		} catch (InterruptedException e) {
			e.printStackTrace();
		} 
		return ic ;
	}

	public int size() {
		return data.size();
	}

	public void putAll(Collection<IContent> c) {
		data.addAll(c);
	}

}
